import request from "@/request/request";
import qs from "qs";
// 游记攻略
export const ApiHomeData = () => request.get("/index/banners/travel");
// 攻略推荐
export const ApiHomeStrategy = () => request.get("/index/banners/strategy");
// 攻略列表
export const ApiQuery = (orderType) =>
  request.get("/travels/query", { params: orderType, currentPage: "1" });
// 登录
export const ApiLogin = (username, password) =>
  request.post("/users/login", qs.stringify(username, password));

// 登录获取当前用户信息   /users/currentUser
export const ApiUserInfo = () => request.get("/users/currentUser");

// 注册  检查手机号是否已经注册
export const ApiPhoneCheck = (params) =>
  request.get("/users/checkPhone", { params });
// 验证码 users/sendVerifyCode
export const ApiVerifyCode = (phone) =>
  request.post("/users/sendVerifyCode", qs.stringify(phone));
// 用户注册  users/regist/
export const ApiRegister = (phone, nickname, password, rpassword, verifyCode) =>
  request.post(
    "/users/regist",
    qs.stringify(phone, nickname, password, rpassword, verifyCode)
  );
// 热门地区
export const ApiHotRegion = () => request.get("/destinations/hotRegion");
// 查询地区内的目的地   destinations/search
export const ApiSearch = (regionId) =>
  request.get("/destinations/search", { params: { regionId } });
// /destinations/toasts   查询目的地吐司层级
export const ApiToasts = (destId) =>
  request.get("/destinations/toasts", { params: { destId } });
//旅游攻略 /strategies/query
export const ApiStrategies = (currentPage, destId, themeId) =>
  request.get("/strategies/query", {
    params: { currentPage, destId, themeId },
  });
// /strategies/themes  攻略主题
export const ApiThemes = () => request.get("/strategies/themes");
// /strategies/detail 攻略详情
export const ApiDetail = (id) =>
  request.get("/strategies/detail", { params: { id } });
// /strategies/addComment 评论攻略
export const ApiAddComment = (content, strategyId, strategyTitle) =>
  request.post(
    "/strategies/addComment",
    qs.stringify({ content, strategyId, strategyTitle })
  );
// /strategies/comments 查询评论
export const ApiComments = (sid, currentPage) =>
  request.get("/strategies/comments", { params: { sid, currentPage } });
